﻿using Inovout.Data.Domain;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Inovout.Organization.Domain
{
    public partial class OrganizationUnit : IOrganizationResource
    {
        public OrganizationUnit(string name,string namePath)
        {
            this.Name = name;
            this.NamePath = namePath;
        }

        private ISet<OrganizationUnit> children = new DataObjectSet<OrganizationUnit>();
        public virtual ISet<OrganizationUnit> Children
        {
            get { return children; }
            set { children = value; }
        }
        private OrganizationUnit parent;
        public virtual OrganizationUnit Parent
        {
            get { return parent; }
            set { parent = value; }
        }
        private ISet<Position> positions = new DataObjectSet<Position>();
        public virtual ISet<Position> Positions
        {
            get { return positions; }
            set { positions = value; }
        }

        public OrganizationUnit()
        { 
        }

        public virtual void addEmployee(Employee employee)
        {
            employee.Organization = this;
            Employees.Add(employee);
        }

    }
}
